/**
 * Social Base
 * All social plugins 'extend' this class
 *
 * @author Seth
 * @version 0.2
 */
var Social = function() {
	// construct
	var __construct = function(plugin, win, params) {
		// load the plugin
		Petolio.loadJs('social/'+ plugin +'.js');

		// call the plugin
		if(win && params)
			Social[plugin.charAt(0).toUpperCase() + plugin.substr(1)].load(win, params);

	// destruct
	}, __destruct = function() {
		// wait for all the loading dialogs to dissapear
		window.setTimeout(function() {
			// loading dialog still exists ? retry
			if($('#dialog-loading').length > 0) {
				__destruct();
				return true;
			}

			// if window, syncronize last overlay height
			if($('.ui-widget-overlay').length > 0)
				$('.ui-widget-overlay').last().css('height', $(document).height());
		}, 100);
	};

	// public
	return {
		load: __construct,
		done: __destruct
	};
}();